package java_thinking.unit_14._14_7_Proxy.Excercise;

import java.lang.reflect.Proxy;

/**
 * @Description :
 * @author: cww
 * @DateTime: 2019/4/1 8:58
 */

public class BusinessProxy {
    public static void userProxy(InterfaceForProxy interfaceForProxy){
        interfaceForProxy.method1();
        interfaceForProxy.method2();
    }

    public static void main(String[] args) {
        DynamicProxyHandler handler = new DynamicProxyHandler(new Business());
        InterfaceForProxy proxy = (InterfaceForProxy)Proxy.newProxyInstance(Business.class.getClassLoader()
                ,new Class[]{InterfaceForProxy.class},handler);
        userProxy(proxy);
    }
}
